<template>
	<!-- 必到-首页 -->
	<view class="home">
		<!-- 导航 -->
		<mescroll-body top="0" :down="downOption" :up="upOption" ref="mescrollRef" :fixed="true" :topbar="false"
			bottom="0" :bottombar="true" :safearea="false" @init="mescrollInit" @down="downCallback">
			<!-- 首页头部 -->
			<scroll-view style="height: 100vh;" lower-threshold="20" @scrolltolower="lower" scroll-y="true"
				class="scroll-Y">
				<view class="heard_bg" style="width: 100%;margin: auto;">
					<!-- <u-navbar class="navbar" :height="navHeight" :background="backgrouds" :is-back="false" title="必到家政"
						:title-color="title_css" :title-bold="true" :border-bottom="false"></u-navbar> -->
					<view
						style="width: 95%;margin: auto;display: flex;justify-content: space-between;align-items: center;padding-top: 10rpx;">
						<view @tap.stop="serach()"
							style="width: 92%;background-color: #F6F6F6; height: 66rpx;border: 1rpx solid #fff;border-radius: 33rpx;position: relative;margin-bottom: 8rpx;">
							<view style="width: 100%;display: flex;align-items: center;">
								<!-- <image style="width: 26rpx;height: 32rpx;margin: 0rpx 10rpx 0rpx 15rpx;"
									src="../../static/gx_img/dw_icon.png"></image> -->
								<u-icon name="map-fill" color="#9B9B9B" style="margin-left: 15rpx;" size="32"></u-icon>
								<view @tap.stop="jumpToSelectCity"
									style="margin-left: 6rpx; width: 100rpx;font-size: 26rpx;line-height: 66rpx; color: #9B9B9B;overflow: hidden;text-overflow:ellipsis;white-space: nowrap;">
									{{ siteName || '郑州市' }}
								</view>
								<view style="height:34rpx ;width: 1rpx;background-color:#D2D2D2 ;margin-right: 18rpx;">
								</view>
								<u-icon name="search" color="#9B9B9B" size="28"></u-icon>
								<view style="font-size: 26rpx;color: #9B9B9B;margin-left: 10rpx;">日常保洁</view>
							</view>
							<view
								style="top:17rpx;right: 2rpx;color: #9B9B9B;    border-left: 1rpx solid #A4A4A4; position: absolute;  text-align: center;line-height: 32rpx; width:106rpx;height: 32rpx;font-size: 26rpx;">
								搜索
							</view>
						</view>
						<view style="width: 42rpx;position: relative;">
							<image @tap="information()" style="width: 44rpx;height: 42rpx;"
								src="https://beedao.oss-cn-beijing.aliyuncs.com/d33472c18ec841d892068ddd75122bbc.png">
							</image>
							<view v-if="total && total > 0"
								style="width: 14rpx;height: 14rpx;border-radius: 10rpx;background-color: #E13436;position: absolute;top: -3rpx;right: -6rpx;">

							</view>
						</view>
					</view>
					<!-- 轮播图 -->
					<view style="width: 95%;margin: auto;border-radius: 20rpx;overflow: hidden;z-index: 99;"
						v-if="slideShowList.length > 0">
						<u-swiper :list="slideShowList" border-radius="20" name="imageUrl" @click="jumpToBanner"
							height="364"></u-swiper>
					</view>
				</view>
				<view style="width: 100%;margin: auto;height: 4px;background: #F5F5F5;"></view>
				<!-- 四金刚区 -->
				<view style="width: 100%;padding-top: 20rpx;background-color: #ffffff;">
					<view style="display: flex;width: 100%;margin:  0 auto;">
						<view @click="gojump(item)" v-for="item in classifyList_one"
							style="width: 25%;justify-content: center;text-align: center;">
							<image style="width: 90rpx;height: 90rpx;" :src="item.icon"></image>
							<view
								style="color: #000000;font-size: 26rpx;margin-top: 14rpx;margin-bottom: 12rpx;text-align: center;">
								{{ item.name }}
							</view>
						</view>
					</view>
					<view style="width: 100%;margin: auto;height: 4px;background: #F5F5F5;"></view>
				</view>
				<!-- 四金刚区结束 -->
				<!-- 十大金刚区 -->
				<view style="width: 100%;padding-top: 20rpx;background-color: #ffffff;">
					<view style="display: flex;width: 95%;margin:  0 auto;flex-wrap: wrap;">
						<view @click="gojump(item)" v-for="item in classifyList"
							style="width: 20%;justify-content: center;text-align: center;">
							<image class="" style="width: 110rpx;height: 110rpx;" :src="item.icon"></image>
							<view class=""
								style="color: #000000;font-size: 26rpx;margin-top: 14rpx;margin-bottom: 24rpx;">
								{{ item.name }}
							</view>
						</view>
					</view>
					<view style="width: 100%;margin: auto;height: 4px;background: #F5F5F5;"></view>
				</view>
				<!-- 十大金刚区 -->
				<view style="width: 100%;margin: auto;height: 4px;background: #F5F5F5;"></view>
				<!-- 非她莫属 -->
				<view style="width: 95%;margin:auto;padding: 12rpx 0rpx;" @click="jumpToMatching">
					<image :src="noSheNoChooseImg" style="width:100%;height: 170rpx;border-radius: 20rpx;"></image>
				</view>
				<view style="width: 100%;margin: auto;height: 4px;background: #F5F5F5;"></view>
				<view style="">
					<u-sticky offset-top="0">
						<scroll-view scroll-x="true" scroll-with-animation="true" class="tab-h" style="padding: 10rpx;"
							:scroll-left="scrollLeft">
							<view class="tab-item" :data-current="tid" @click="swichNav" v-for="(ite,tid) in remen"
								:key="tid">
								<view style="line-height: 60rpx;font-size: 34rpx;"
									:style="{color:currentTab==tid?'#EE0C00':'#4E4E4E'}">{{ite.hotName}}</view>
								<view :style="{color:currentTab==tid?'#FFFFFF':'#9E9E9E',
								'background-color':currentTab==tid?'#EE0C00':'#FFFFFF'
								}" style="line-height: 36rpx;border-radius: 20rpx;padding: 5rpx 18rpx;text-align: center;font-size: 28rpx;">
									{{ite.hotSubtitle?ite.hotSubtitle:'精选服务'}}
								</view>
							</view>
						</scroll-view>
					</u-sticky>
					<view style="background-color: #F8F8F8 !important;min-height: 600rpx;">
						<view style="width: 98%;margin: 0 auto;">
							<u-waterfall v-model="shopList" ref="uWaterfall">
								<template v-slot:left="{leftList}">
									<view class="demo-warter" @click="shopDetail(item.enterpriseId)"
										v-for="(item, index) in leftList" :key="index">

										<u-lazy-load :threshold="20" duration="200"
											loading-img="https://beedao.oss-cn-beijing.aliyuncs.com/7b99328d577c4c13afe08c277141d574.png"
											border-radius="10" height="auto"
											:image="item.listPicture?item.listPicture:defaultImg" :index="index">
										</u-lazy-load>
										<view style="padding: 12rpx;border-bottom: 1rpx solid #EEEEEE;">
											<view class="demo-title">
												{{item.name}}
											</view>
											<view class="demo-price">
												销量{{item.serverNum}}丨评分{{item.score}}
											</view>
											<view class="demo-tag" v-if="item.isActivity == 1">
												<view class="demo-tag-text">
													{{item.activityName}}
												</view>
											</view>
											<view class="demo-shop">
												距离{{item.distance?item.distance:'0'}}㎞
											</view>
										</view>
										<view
											style="display: flex;line-height: 50rpx;color:#B2B2B2 ;padding:6rpx 12rpx;align-items: center;justify-content: space-between;">
											<view style="width: 65%;">
												<view
													style="width: 230rpx;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
													{{item.name}}
												</view>
											</view>
											<view style="display: flex;">
												<view>进店</view>
												<u-icon
													style="margin-left: 5rpx;display: flex;align-items: center;justify-content: center;"
													name="arrow-right" color="#B2B2B2" size="22"></u-icon>
											</view>
										</view>
									</view>
								</template>
								<template v-slot:right="{rightList}">
									<view class="demo-warter" @click="shopDetail(item.enterpriseId)"
										v-for="(item, index) in rightList" :key="index">
										<!-- 警告：微信小程序中需要hx2.8.11版本才支持在template中结合其他组件，比如下方的lazy-load组件 -->
										<u-lazy-load :threshold="20" duration="200"
											loading-img="https://beedao.oss-cn-beijing.aliyuncs.com/7b99328d577c4c13afe08c277141d574.png"
											border-radius="10" height="auto"
											:image="item.listPicture?item.listPicture:defaultImg" :index="index">
										</u-lazy-load>
										<view style="padding: 12rpx;border-bottom: 1rpx solid #EEEEEE;">
											<view class="demo-title">
												{{item.name}}
											</view>
											<view class="demo-price">
												销量{{item.serverNum}}丨评分{{item.score}}
											</view>
											<view class="demo-tag" v-if="item.isActivity == 1">
												<view class="demo-tag-text">
													{{item.activityName}}
												</view>
											</view>
											<view class="demo-shop">
												距离{{item.distance?item.distance:'0'}}㎞
											</view>
										</view>
										<view
											style="display: flex;line-height: 50rpx;color:#B2B2B2 ;padding:6rpx 12rpx;align-items: center;justify-content: space-between;">
											<view style="width: 65%;">
												<view
													style="width: 230rpx;display:block;white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
													{{item.name}}
												</view>
											</view>
											<view style="display: flex;">
												<view>进店</view>
												<u-icon
													style="margin-left: 5rpx;display: flex;align-items: center;justify-content: center;"
													name="arrow-right" color="#B2B2B2" size="22"></u-icon>
											</view>
										</view>
									</view>
								</template>
							</u-waterfall>
							<view style="padding: 40rpx 0;background-color: #F8F8F8;color: #DEDEDE;" v-if="!showList">
								<view style="width: 100%;text-align: center;">{{ prompt }}</view>
							</view>
							<!-- <u-loadmore style="padding: 30rpx 0;" bg-color="rgb(240, 240, 240)" :status="loadStatus"
								@loadmore="addRandomData">
							</u-loadmore> -->
						</view>
					</view>
				</view>
			</scroll-view>
		</mescroll-body>

		<u-toast ref="uToast" />
		<u-mask :show="showt1" :duration="100">
			<view class="warpss" style="height:100vh;display: flex;justify-content: center;align-items: center;">
				<view class="rect" style="width:100%;position: relative;">
					<image @tap="jump_activity1()" style="width: 100%;height: auto;"
						:src="advertisingForm.advertisingImage" mode="widthFix"></image>
					<view v-if="advertisingForm.advertisingImage"
						style="width: 100%;margin: 20rpx auto;text-align: center;">
						<image @tap.stop="quxiao1()" style="width: 70rpx;height: 70rpx;"
							src="https://beedao.oss-cn-beijing.aliyuncs.com/68815805367341938658a9891b1ef78b.png">
						</image>
					</view>
				</view>
			</view>
		</u-mask>

	</view>
</template>

<script>
	import amap from '../../components/map/amap-wx.js';
	var that;
	export default {
		data() {
			return {
				mapPram: {
					lat: '',
					lng: '',
				},
				showt1: false,
				backgrouds: {
					backgroundColor: 'rgba(255,255,255,0)'
				},

				title_css: '#3F3F3F',
				remen: [],
				hotServicesId: '',
				customStyle: {
					padding: '8rpx 0'
				},
				icon: [{
					searchContent: '空调清洗'
				}, {
					searchContent: '日常保洁'
				}, {
					searchContent: '洗衣机清洗'
				}, {
					searchContent: '开荒保洁'
				}],
				siteName: '', //地址
				slideShowList: [], //轮播图
				noticeList: [], //公告
				classifyList_one: [], //金刚区list
				classifyList: [], //金刚区list
				messageCount: 0,
				// 下拉刷新配置
				downOption: {
					use: true,
					auto: false,
					offset: 40
				},
				upOption: {
					use: true,
					auto: false
				},
				mescroll: null,
				rangeMin: 5,
				rangMax: 100,
				rangeValue: [10, 50],
				show: true, // 弹窗显示与隐藏
				count: 5,
				value: 3,
				page: 1,
				pageSize: 15,
				shopList: [],
				prompt: '',
				showList: false,
				totalPage: 1,
				noSheNoChooseImg: '',
				token: '',
				userinfo: '',
				jianjuheight: '',
				tan_height: '',
				userId: '',
				total: 0,
				currentTab: 0, //预设当前项的值
				scrollLeft: 0, //tab标题的滚动条位置
				classList: [{
						name: "冰箱清洗",
						title: "精选服务"
					},
					{
						name: "家电维修",
						title: "保质保量"
					},
					{
						name: "家政保洁",
						title: "满意为止"
					},
					{
						name: "洗衣洗鞋",
						title: "免费送取"
					},
					{
						name: "空调清洗",
						title: "清除细菌"
					},
				],
				defaultImg: "https://beedao.oss-cn-beijing.aliyuncs.com/618803010eda471a9a93ceda136dfe39.png", //默认商家图片
				loadStatus: 'loadmore',
				advertisingForm: {}, //广告对象
				list: [], //懒加载数组
				isOnce: 0, //是否是第一次请求数据0是1不是
			};
		},
		onShow() {
			var that = this;
			that.token = uni.getStorageSync('token');
			//判断是否登录
			if (!that.token) {
				uni.hideShareMenu();
			} else {
				uni.showShareMenu();
				var userInfo = JSON.parse(uni.getStorageSync('userinfo'));
				this.userId = userInfo.userId;
			}
			var siteNames = '';
			if (that.isOnce == '1') {
				uni.getStorage({
					key: 'siteName',
					success: res => {
						siteNames = res.data;
						if (that.siteName !== siteNames) {
							that.siteName = siteNames;
							that.clear();
							that.getShop(that.hotServicesId);
						}
					},
				});
			}

		},
		onLoad(option) {
			var parentId = option.parentId;
			if (parentId) {
				uni.setStorageSync('parentId', parentId);
				uni.navigateTo({
					url: '../login/login'
				})
			}
			that = this;
			that.token = uni.getStorageSync('token');
			that.userinfo = uni.getStorageSync('userinfo');
			that.getHomeData();
			that.getBanner();
			that.getLocationInfo();
			if (that.token) {
				that.getMessage(); //获取首页未读数量
			}
			that.getGridData(0);
			that.getGridData(1);
			that.getAdvertisingForm()
			if (option.type) {
				if (!that.token) {
					var id = option.id;
					if (id) {
						uni.setStorageSync('parentId', id);
					}
					uni.navigateTo({
						url: '../login/login'
					});
					return false;
				}
				var type = option.type;
				if (type == 1) {
					//去商家主页
					var enterpriseId = option.enterpriseId;
					var hotId = option.hotId;
					uni.navigateTo({
						url: '/pageageA/home/shopDetails/shopDetails?enterpriseId=' + enterpriseId + '&hotId=' +
							hotId
					});
				} else if (type == 2) {
					//团购详情分享进入
					var enterpriseId = option.enterpriseId;
					var packageBusinessId = option.packageBusinessId;
					uni.navigateTo({
						url: '/pageageA/home/shopDetails/tuangouDetails/tuangouDetails?packageBusinessId=' +
							packageBusinessId + '&enterpriseId=' + enterpriseId
					});
				} else if (type == 3) {
					// 他的简历
					var id = option.id;
					var employeeId = option.employeeId;
					var redirectId = option.redirectId;
					var addType = option.addType;
					var types = option.types;
					uni.navigateTo({
						url: '/pageageA/home/matching/hisResume/hisResume?employeeId=' + employeeId +
							'&redirectId=' + redirectId + '&addType=' + addType + '&type=' + types
					});
				} else if (type == 4) {
					// 按次预约下单
					var businessId = option.businessId;
					uni.navigateTo({
						url: '/pageageA/placeOrder/selectService?businessId=' + businessId
					});
				} else if (type == 5) {
					// 按次预约下单
					uni.navigateTo({
						url: '/pageageA/personal/recruit'
					});
				}
			}
		},

		methods: {
			clear() {
				this.$refs.uWaterfall.clear();
			},
			// 点击标题切换当前页时改变样式
			swichNav: function(e) {
				this.prompt = "正在加载...";
				var cur = e.currentTarget.dataset.current;
				if (this.currentTaB == cur) {
					return false;
				} else {
					this.currentTab = cur;
				}
				this.checkCor();
				this.page = 1;
				this.$refs.uWaterfall.clear();
				this.hotServicesId = this.remen[cur].hotServicesId
				this.getShop(this.hotServicesId);
			},
			//判断当前滚动超过一屏时，设置tab标题滚动条。
			checkCor: function() {
				if (this.currentTab > 2) {
					this.scrollLeft = 200;
				} else {
					this.scrollLeft = 0;
				}
			},

			// 分享给朋友
			onShareAppMessage(res) {
				if (res.from === 'button') {
					// 来自页面内分享按钮
				}
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'common/insertShareLog'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					//分享日志，不需要处理
				});
				return {
					title: '必到家政',
					path: '/pages/login/login?id=' + this.userId + "&jumpType=" + 1
					// imageUrl:'https://beedao.oss-cn-beijing.aliyuncs.com/cca1cf07545140e6b44c42f1c9b861d8.png',
					// path: '/pages/home/home?parentId=' + this.userId
				};
			},

			//获取未读数量
			getMessage() {
				var _this = this;
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'message/getUnreadCount'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					_this.total = res.data;
				});
			},
			// 分享到朋友圈
			onShareTimeline() {
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'common/insertShareLog'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					//分享日志，不需要处理
				});
				return {
					title: '必到家政',
					query: 'parentId=' + this.userId
					// imageUrl:'https://beedao.oss-cn-beijing.aliyuncs.com/cca1cf07545140e6b44c42f1c9b861d8.png',
					// path: '/pages/home/home?parentId=' + this.userId
				};
			},
			//去全部服务
			more_service() {
				uni.switchTab({
					url: '/pages/service/service'
				});
			},
			//隐藏活动弹框
			quxiao1() {
				this.showt1 = false;
			},
			// 点击活动弹框
			jump_activity1() {
				if (!this.token) {
					this.islogin();
					return;
				}
				uni.navigateTo({
					url: '/pageageA/member/meCenter'
				});
				this.showt1 = false;
			},
			// 跳转到消息
			information() {
				if (!this.token) {
					this.islogin();
					return;
				}
				uni.navigateTo({
					url: '/pageageA/home/information/information'
				});
			},

			// 热门搜索
			jumps_fw(keyword) {
				uni.navigateTo({
					url: '/pageageA/home/search/search_result?keyword=' + keyword + "&siteName=" + this.siteName
				});
			},
			serach() {
				uni.navigateTo({
					url: '../../pageageA/home/search/search'
				});
			},
			scroll: function(e) {},

			// 登录判断
			islogin() {
				uni.showModal({
					title: '登录提示',
					content: '该功能需要登录后使用。',
					confirmText: '去登录',
					success: function(res) {
						if (res.confirm) {
							uni.navigateTo({
								url: '/pages/login/login'
							});
						} else if (res.cancel) {}
					}
				});
				return;
			},


			// 获取首页轮播图
			getBanner() {
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'index/getBanner'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					//打印请求返回的数据
					if (res.code == '200') {
						this.slideShowList = res.data;
					} else {
						this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//获取数据
			getHomeData: function() {
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'index/home'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					//打印请求返回的数据
					this.noSheNoChooseImg = res.data.noSheNoChooseImg;
					if (res.code == '200') {
						//公告
						if (res.data.notices) {
							this.noticeList = [];
							for (let i = 0; i < res.data.notices.length; i++) {
								this.noticeList.push(res.data.notices[i].title);
							}
						}
						//未读消息
						this.messageCount = res.data.messages;
					} else {
						this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//获取广告图
			getAdvertisingForm: function() {
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'index/getAdvertisingList'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					//打印请求返回的数据
					if (res.code == '200') {
						this.advertisingForm = res.data;
						if (this.advertisingForm.advertisingSwitch == 1) {
							this.showt1 = true;
						} else {
							this.showt1 = false;
						}
					} else {
						this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//获取金刚区图标
			getGridData: function(iconType) {
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'index/getGrid'
				};
				let data = {
					iconType: iconType
				};
				this.http.httpTokenRequest(opts, data).then(res => {
					//打印请求返回的数据
					if (res.code == '200') {
						if (iconType == 1) {
							this.classifyList_one = res.data;
						} else {
							this.classifyList = res.data;
							this.classifyList.push({
								icon: "https://beedao.oss-cn-beijing.aliyuncs.com/37865f79c17c4015ad1523dc850efb8e.png",
								name: "更多服务",
								redirectType: 10,
							})
						}
					} else {
						this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//热门服务分类
			getBusinessList: function() {
				let opts = {
					way: true,
					method: 'post',
					url: 'index/getBusiness'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					if (res.code == '200') {
						this.remen = res.data;
						if (this.hotServicesId == "") {
							this.hotServicesId = this.remen[0].hotServicesId;
						}
						this.getShop(this.hotServicesId);
					} else {
						this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//获取业务数据
			getBusinessData: function() {
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'index/business'
				};
				let data = {};
				this.http.httpTokenRequest(opts, data).then(res => {
					//打印请求返回的数据
					if (res.code == '200') {
						// this.remen = res.data;

						for (let i = 0; i < res.data.length; i++) {
							switch (res.data[i].displayType) {
								case 1:
									this.oneList = res.data[i];
									break;
								case 2:
									this.towList = res.data[i];
									break;
								case 3:
									this.threeList = res.data[i];
									break;
								case 4:
									this.fourList = res.data[i];
									break;
								default:
									break;
							}
						}
					} else {
						this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			jumpToBanner: function(index) {
				if (!this.token) {
					this.islogin();
					return;
				}
				var item = this.slideShowList[index];
				switch (item.redirectType) {
					case 1:
						//非她莫属
						uni.navigateTo({
							url: '../../pageageA/home/matching/matching'
						});
						break;
					case 2:
						//保姆列表
						uni.navigateTo({
							url: '/pageageA/home/almightyNanny/almightyNanny?titleName=' + item.remark +
								'&redirectId=' + item.redirectUrl
						});
						break;
					case 3:
						//跳转二级分类页
						uni.switchTab({
							url: '../service/service'
						});

						break;
					case 4:
						//一键匹配
						uni.navigateTo({
							url: '../../pageageA/service/matching/matching?chargeType=' + item.chargeType +
								'&businessId=' + item.redirectUrl
						});
						break;
					case 5:
						//家政人员简历
						uni.navigateTo({
							url: '../../pageageA/home/matching/hisResume/hisResume?resumeId=' + item
								.redirectUrl
						});
						break;

					case 6:
						//活动页
						uni.navigateTo({
							url: '../../pageageA/home/fwb_home?activity=' + item.redirectUrl
						});
						break;
					case 7:
						//跳转文章
						uni.navigateTo({
							url: '../../pageageA/home/fwb_home?activity=' + encodeURIComponent(item
								.redirectUrl)
						});
						break;
					case 8:
						uni.navigateTo({
							url: '../../pageageA/service/serviceDetail?redirectId=' + item.redirectUrl +
								'&titleName=' + item.name + '&chargeType=' + item.chargeType
						});
						break;
					case 9:
						uni.navigateTo({
							url: '../../pageageA/placeOrder/selectService?businessId=' + item.redirectUrl
						});
						break;

					default:
						break;
				}
			},
			//点击金刚区跳转页面
			gojump(item) {
				if (!this.token) {
					this.islogin();
					return;
				} else {
					switch (item.redirectType) {
						case 1:
							//非她莫属
							uni.navigateTo({
								url: '../../pageageA/home/matching/matching?serviceType=' + item.redirectId +
									'&titleName=' + item.name
							});
							break;
						case 2:
							//保姆列表
							uni.navigateTo({
								url: '../../pageageA/home/almightyNanny/almightyNanny?titleName=' + item.name +
									'&redirectId=' + item.redirectId
							});
							break;
						case 3:
							//跳转二级分类页
							uni.switchTab({
								url: 'pages/service/service'
							});
						case 4:
							uni.navigateTo({
								url: '../../pageageA/service/matching/matching?businessId=' + item.redirectId +
									'&chargeType=' + item.chargeType + '&titleName=' + item.name
							});
							break;
						case 6:
							//公众号
							// uni.navigateTo({
							// 	url: '../../pageageA/service/matching/matching?businessId=' + item.redirectId + '&chargeType=' + item.chargeType
							// });
							// if (item.redirectUrl.includes('https://') || item.redirectUrl.includes('http://')) {
							// 	location.href = item.redirectUrl;
							// } else {
							// 	location.href = 'https://${item.redirectUrl}';
							// }
							uni.navigateTo({
								url: '../../pageageA/home/fwb_home?activity=' + item.redirectUrl
							});

							break;
						case 8:
							uni.navigateTo({
								url: '../../pageageA/service/serviceDetail?redirectId=' + item.redirectId +
									'&titleName=' + item.name + '&chargeType=' + item.chargeType
							});
							break;
						case 9:
							uni.navigateTo({
								url: '../../pageageA/placeOrder/selectService?businessId=' + item.redirectId
							});
							break;
						case 10:
							this.more_service()
							break;
						default:
							break;
					}
				}
			},
			mescrollInit(mescroll) {
				this.mescroll = mescroll;
			},
			// 下拉刷新回调函数
			downCallback() {
				setTimeout(() => {
					this.page = 1;
					this.shopList = [];
					this.mescroll.endSuccess();
					// this.$refs.uWaterfall.clear();
					// this.getLocationInfo();
					this.getBusinessList();
					that.getBanner();
					this.getHomeData();
					// this.getBusinessData();
					this.getGridData(0);
					this.getGridData(1);
					//获取活动
					that.getAdvertisingForm()
					if (this.token) {
						this.getMessage(); //获取首页未读数量
					}
					this.prompt = '加载中....';
				}, 2000);
			},
			// 触底事件
			lower(e) {
				// 模拟数据加载
				if (this.totalPage <= this.page) {
					return false;
				} else {
					this.page += 1;
					this.getShop(this.hotServicesId);
				}
			},
			//获取当前经纬度和城市
			getLocationInfo() {
				var _this = this
				uni.getLocation({
					type: 'wgs84',
					success(res) {
						let latitude, longitude;
						_this.mapPram.lat = res.latitude;
						_this.mapPram.lng = res.longitude;
						latitude = res.latitude.toString();
						longitude = res.longitude.toString();
						var myAmapFun = new amap.AMapWX({
							key: _this.http.mapVxKey
						});
						myAmapFun.getRegeo({
							location: '' + longitude + ',' + latitude + '', //location的格式为'经度,纬度'
							success: function(e) {
								_this.siteName = e[0].regeocodeData.addressComponent.city; //城市
								if (typeof(_this.siteName) == 'object') {
									_this.siteName = e[0].regeocodeData.addressComponent.province; //城市
								}
								uni.setStorage({
									key: 'siteName',
									data: _this.siteName
								});
								_this.getBusinessList();
							},
							fail: function(info) {
								_this.getBusinessList();
							}
						});
					},
					fail(resd) {
						_this.siteName = '郑州市'; //城市						
						uni.setStorage({
							key: 'siteName',
							data: _this.siteName
						});
						_this.getBusinessList();
					}
				});

			},
			//判断是否成功授权，未收授权让用户手动去授权
			again_getLocation: function() {
				let that = this;
				// 获取位置信息
				uni.getSetting({
					success: (res) => {
						if (res.authSetting['scope.userLocation'] != undefined && res.authSetting[
								'scope.userLocation'] != true) { //非初始化进入该页面,且未授权
							uni.showModal({
								title: '是否授权当前位置',
								content: '需要获取您的地理位置，请确认授权，否则无法获取您所需数据',
								success: function(res) {
									if (res.cancel) {
										uni.showToast({
											title: '位置授权失败',
											icon: 'none',
											duration: 1000
										})
									} else if (res.confirm) {
										uni.openSetting({
											success: function(dataAu) {
												if (dataAu.authSetting[
														"scope.userLocation"] ==
													true) {
													uni.showToast({
														title: '授权成功',
														icon: 'none',
														duration: 1000
													})
													//再次授权，调用getLocationt的API
													that.getLocationInfo();
												} else {
													uni.showToast({
														title: '位置授权失败',
														icon: 'none',
														duration: 1000
													})
												}
											}
										})
									}
								}
							})
						} else if (res.authSetting['scope.userLocation'] == undefined) { //初始化进入
							that.getLocationInfo();
						} else { //授权后默认加载
							that.getLocationInfo();
						}
					}
				})

			},
			//跳转选择城市
			jumpToSelectCity: function() {
				if (!this.token) {
					this.islogin();
					return;
				} else {
					uni.navigateTo({
						url: '/pageageA/home/selectCity/selectCity?cityName=' + this.siteName
					});
				}
			},
			//跳转公告
			jumpToNoticeList: function() {
				// this.islogin();

				if (!this.token) {
					this.islogin();
					return;
				} else {
					uni.navigateTo({
						url: '../../pageageA/home/noticeList/noticeList'
					});
				}
			},
			//跳转非她莫属
			jumpToMatching: function() {
				// this.islogin();
				if (!this.token) {
					this.islogin();
					return;
				} else {
					uni.navigateTo({
						url: '../../pageageA/home/matching/matching'
					});
				}
			},
			//跳转消息
			jumpToInfomation: function() {
				// this.islogin();
				if (!this.token) {
					this.islogin();
					return;
				} else {
					uni.navigateTo({
						url: '../../pageageA/home/information/information'
					});
				}
			},
			// 获取附近商家
			getShop(id) {
				var _this = this;
				if (_this.page == 1) {
					_this.shopList = [];
				}
				let opts = {
					way: true, //true JSON请求；false 表单请求
					method: 'post',
					url: 'index/nearEnt'
				};
				let data = {
					page: _this.page,
					pageSize: _this.pageSize,
					city: _this.siteName,
					businessIds: id,
					lat: _this.mapPram.lat,
					lng: _this.mapPram.lng,
				};
				_this.http.httpTokenRequest(opts, data).then(res => {
					if (res.code == 200) {
						this.isOnce = 1;
						this.totalPage = res.data.pages;
						if (_this.page == 1) {
							_this.shopList = res.data.records;
							_this.prompt = '没有更多了';
						} else if (_this.page != 1) {
							_this.showList = false;
							_this.shopList = [..._this.shopList, res.data.records]
							_this.prompt = '加载中....';
						} else {
							_this.showList = true;
							_this.shopList = [];
							_this.prompt = '没有更多了';
						}
					} else {
						_this.$refs.uToast.show({
							title: res.message,
							type: 'error'
						});
					}
				});
			},
			//跳转商家详情
			shopDetail(enterpriseId) {
				if (!this.token) {
					this.islogin();
					return;
				} else {
					// hotId为服务id
					uni.navigateTo({
						url: '../../pageageA/home/shopDetails/shopDetails?enterpriseId=' + enterpriseId
					});
				}
			}
		}
	};
</script>
<style>
	.u-swiper-wrap swiper {
		background-color: rgba(255, 255, 255, 0.2);
	}

	.home .u-lazy-item {
		border-radius: 8rpx 8rpx 0 0 !important;
	}

	.home-gird .u-badge {
		padding: 5rpx 14rpx !important;
		border-radius: 12rpx 12rpx 12rpx 0px !important;
	}

	.demo-warter .u-wrap {
		background-color: #FFFFFF !important;
		border-radius: 8rpx 8rpx 0 0 !important;
	}

	.home .u-load-more-wrap {
		padding: 30rpx 0;
	}
</style>
<style scoped lang="scss">
	.demo-warter {
		border-radius: 8px;
		margin: 12rpx;
		background-color: #ffffff;
		// padding: 8px;
		position: relative;
	}

	.u-close {
		position: absolute;
		top: 32rpx;
		right: 32rpx;
	}

	.demo-image {
		width: 100%;
		border-radius: 4px;
	}

	.demo-title {
		font-size: 30rpx;
		margin-top: 5px;
		color: $u-main-color;
	}

	.demo-tag {
		display: flex;
		margin-top: 5px;
	}

	.demo-tag-owner {
		background-color: $u-type-error;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		padding: 4rpx 14rpx;
		border-radius: 50rpx;
		font-size: 20rpx;
		line-height: 1;
	}

	.demo-tag-text {
		border: 1px solid #EE0C00;
		color: #EE0C00;
		// margin-left: 10px;
		border-radius: 50rpx;
		line-height: 1;
		padding: 6rpx 14rpx;
		display: flex;
		align-items: center;
		border-radius: 50rpx;
		font-size: 26rpx;
	}

	.demo-price {
		font-size: 30rpx;
		color: $u-type-error;
		margin-top: 5px;
	}

	.demo-shop {
		font-size: 26rpx;
		color: #B2B2B2;
		margin-top: 5px;
	}

	.tab-h {
		width: 100%;
		box-sizing: border-box;
		overflow: hidden;
		background: #FFFFFF;
		font-size: 30rpx;
		white-space: nowrap;
		z-index: 99;
	}

	.tab-item {
		margin: 0 36rpx;
		display: inline-block;
	}

	.tab-content {
		margin-top: 80rpx;
		min-height: 800rpx;
	}

	.warpss {
		width: 92%;
		margin: auto;
		font-family: PingFang SC;
	}

	.u-mode-center-box.data-v-52d4ddd1 {
		width: 100% im;
		min-height: 100rpx;
		display: block;
		position: relative;
		background-color: #ffffff;
	}

	.city {
		position: sticky;
		z-index: 990;
		top: 60rpx;
		left: 47rpx;
	}

	.choose_1 {
		color: white;
		background-color: #FF9E63;
		// background: linear-gradient(135deg, transparent 57rpx, #ff9c64 0); //切角效果
		// border-radius:100rpx 30rpx 0rpx 0rpx;
		border-top-right-radius: 20rpx;
		border-top-left-radius: 20rpx;
	}

	.choose_2 {
		color: #6b6b6b;
	}

	.heard_bg {
		width: 100%;
		// height: 634rpx;
		// background-image: url(https://beedao.oss-cn-beijing.aliyuncs.com/aefecf18722e4d5e9a3dcd1b70a09ab2.png);
		// background-size: 100% 100%;
		// background-repeat: no-repeat;
	}

	.classify-img {
		width: 118rpx;
		height: 118rpx;
		border-radius: 50%;
	}

	.information {
		position: fixed;
		z-index: 2;
		top: 478rpx;
		right: 5rpx;
	}

	.sa_bottoms {
		padding: 26rpx 0rpx 0rpx 0rpx;
		border-top: 2rpx solid #e8e8f6;
	}

	.tables {
		// margin: 0rpx 16rpx;
		// margin-top: 20rpx;
		height: auto;
		// width: 92%;
		// margin: auto;
		background: #ffffff;
		// box-shadow: 0px 6px 12px rgba(0, 0, 0, 0.16);
		// opacity: 1;
		// border-radius: 20px;
	}

	.typeface1 {
		font-size: 38rpx;
		font-family: ZHSCNMT-GBK;
		font-weight: 500;
		color: #3f3f3f;
		opacity: 1;
		margin-left: 14rpx;
	}

	.more {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #f29423;
		opacity: 1;
	}

	.typeface2 {
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #3f3f3f;
		opacity: 1;
	}

	.typeface3 {
		font-size: 22rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #979797;
		opacity: 1;
	}

	.warp {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 100%;
	}

	.top {
		margin-left: 30rpx;
		padding-top: 10rpx;
		display: flex;
		align-items: center;
	}

	.top image {
		width: 34rpx;
		height: 34rpx;
		vertical-align: middle;
		margin-left: 20rpx;
	}

	.unit {
		padding: 20rpx 0rpx 10rpx 0rpx;
		width: 100%;
		margin: auto;
	}

	.unit1 {
		// display: flex;
		padding-bottom: 24rpx;
		// border-bottom: 1px solid #e8e8f6;
	}

	.unit1 .img {
		width: 122rpx;
		height: 122rpx;
		background: #e4e4e4;
		opacity: 1;
	}

	.unit1 .shop {
		// width: 78%;
		// margin-left: 18rpx;
	}

	.shop .all {
		display: flex;
		// justify-content: space-between;
		align-items: flex-start;
	}

	.shop .all .nam {
		font-size: 30rpx;
		color: #3f3f3f;
		font-weight: 500;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}

	.shop .all .year {
		width: 160rpx;
		height: 36rpx;
		background: #fff2d9;
		border: 1px solid #f29423;
		opacity: 1;
		border-radius: 10rpx 0px 10rpx 0px;
		font-size: 22rpx;
		color: #f29423;
		text-align: center;
		margin-left: 16rpx;
	}

	.bott {
		display: flex;
		justify-content: space-between;
		color: #9393aa;
		font-size: 26rpx;
		margin-top: 14rpx;
	}

	.service {
		display: flex;
		align-items: center;
	}

	.service image {
		width: 29rpx;
		height: 27rpx;
	}

	.service view {
		padding-left: 10rpx;
	}

	.unit2 {
		// display: flex;
	}

	.unit2 .white {
		width: 122rpx;
	}

	.sales {
		// width: 78%;
		// border-bottom: 2rpx solid #e8e8f6;
		padding: 24rpx 0 24rpx 0rpx;
	}

	.hour {
		font-size: 26rpx;
		color: #9393aa;
		display: flex;
		align-items: center;
	}

	.hour .tao {
		color: #f29423;
		font-size: 20rpx;
		border: 1px solid #f29423;
		text-align: center;
		margin-left: 16rpx;
		padding: 0 8rpx;
		height: 28rpx;
		line-height: 26rpx;
	}

	.money {
		width: 100%;
		display: flex;
		justify-content: space-between;
		margin-top: 4rpx;
	}

	.money .sale {
		display: flex;
		font-size: 26rpx;
	}

	.sale .price {
		color: #f29423;
	}

	.sale .prices {
		// text-decoration: line-through;
		font-size: 20rpx;
		color: #ceced1;
		// margin-left: 12rpx;
	}

	.over {
		color: #9393aa;
		font-size: 26rpx;
	}

	// tabberyangshi
</style>
